from socket import *

HOST = 'localhost'
PORT = 21568
BUFSIZE = 1024

ADDR = (HOST, PORT)

tcpSocket = socket(AF_INET, SOCK_STREAM)
tcpSocket.connect(ADDR)

while True:
    data = raw_input(">")
    if not data:
        break
    tcpSocket.send(data)

    ret = tcpSocket.recv(BUFSIZE)
    
    print 'recv:',ret

tcpSocket.close()
